*CLEAR
clear

*****

*GET DATA
use "JBPA connolly et al data.dta"

*****

*CULL DATA FOR REPLICATION FILE
keep Q63a Q63b Q63c Q63d Q63e Q63f

*****

*MESSAGING EXPERIMENT

*get n for each treatment group
tab Q63a
tab Q63b
tab Q63c
tab Q63d
tab Q63e
tab Q63f

*create factor item for the experimental treatment
generate message=.

replace message=1 if Q63a !=.
tab Q63a
tab message
tab message Q63a

replace message=2 if Q63b !=.
tab Q63b
tab message
tab message Q63b

replace message=3 if Q63c !=.
tab Q63c
tab message
tab message Q63c

replace message=4 if Q63d !=.
tab Q63d
tab message
tab message Q63d

replace message=5 if Q63e !=.
tab Q63e
tab message
tab message Q63e

replace message=6 if Q63f !=.
tab Q63f
tab message
tab message Q63f

tab message
label define message_label 1 "control" 2 "uncertain" 3 "neighbors" 4 "gas cards" 5 "police" 6 "death toll"
label values message message_label
tab message

*combine and flip compliance items regardless of treatment (dropping DK responses)
generate comply=.

replace comply=1 if Q63a==4
replace comply=2 if Q63a==3
replace comply=3 if Q63a==2
replace comply=4 if Q63a==1

replace comply=1 if Q63b==4
replace comply=2 if Q63b==3
replace comply=3 if Q63b==2
replace comply=4 if Q63b==1

replace comply=1 if Q63c==4
replace comply=2 if Q63c==3
replace comply=3 if Q63c==2
replace comply=4 if Q63c==1

replace comply=1 if Q63d==4
replace comply=2 if Q63d==3
replace comply=3 if Q63d==2
replace comply=4 if Q63d==1

replace comply=1 if Q63e==4
replace comply=2 if Q63e==3
replace comply=3 if Q63e==2
replace comply=4 if Q63e==1

replace comply=1 if Q63f==4
replace comply=2 if Q63f==3
replace comply=3 if Q63f==2
replace comply=4 if Q63f==1	

tab comply

*ANOVA analysis
sort message
by message: means comply
oneway comply message, bonferroni
oneway comply message, sidak
	*now look at differences between the five treatment groups
anova comply message
pwcompare message

*replicate original ANOVA with ordered probit
	*create dummies for the treatments
		*control
generate control=0
replace control=1 if message==1
tab message control
		*uncertainty
generate uncert=0
replace uncert=1 if message==2
tab message uncert
		*neighbors
generate neighbor=0
replace neighbor=1 if message==3
tab message neighbor
		*gas cards
generate gas=0
replace gas=1 if message==4
tab message gas
		*police enforcement
generate police=0
replace police=1 if message==5
tab message police
		*death toll
generate death=0
replace death=1 if message==6
tab message death
	*analysis (control is omitted category)
oprobit comply uncert neighbor gas police death

*extend original analysis coding dk responses to DV as mid-point of scale
	*combine and flip compliance items regardless of treatment (code DK = 3)
generate comply_dk3=.

replace comply_dk3=1 if Q63a==4
replace comply_dk3=2 if Q63a==3
replace comply_dk3=3 if Q63a==6
replace comply_dk3=4 if Q63a==2
replace comply_dk3=5 if Q63a==1

replace comply_dk3=1 if Q63b==4
replace comply_dk3=2 if Q63b==3
replace comply_dk3=3 if Q63b==6
replace comply_dk3=4 if Q63b==2
replace comply_dk3=5 if Q63b==1

replace comply_dk3=1 if Q63c==4
replace comply_dk3=2 if Q63c==3
replace comply_dk3=3 if Q63c==6
replace comply_dk3=4 if Q63c==2
replace comply_dk3=5 if Q63c==1

replace comply_dk3=1 if Q63d==4
replace comply_dk3=2 if Q63d==3
replace comply_dk3=3 if Q63d==6
replace comply_dk3=4 if Q63d==2
replace comply_dk3=5 if Q63d==1

replace comply_dk3=1 if Q63e==4
replace comply_dk3=2 if Q63e==3
replace comply_dk3=3 if Q63e==6
replace comply_dk3=4 if Q63e==2
replace comply_dk3=5 if Q63e==1

replace comply_dk3=1 if Q63f==4
replace comply_dk3=2 if Q63f==3
replace comply_dk3=3 if Q63f==6
replace comply_dk3=4 if Q63f==2
replace comply_dk3=5 if Q63f==1

tab comply_dk3

	*oprobit analysis (control is omitted category)
oprobit comply_dk3 uncert neighbor gas police death
	


